// if
function removeWithoutCopy (arr, item) {
    for (let i = 0; i < arr.length; i++) {
        if (arr[i] == item) {
            arr.splice(i, 1);
            i--;//处理索引左移
        }
    }
    return arr;
}

//while
function removeWithoutCopy (arr, item) {
    for (let i = 0; i < arr.length; i++) {
        while (arr[i] == item) {
            arr.splice(i, 1);
        }
    }
    return arr;
}

// if 倒查
function removeWithoutCopy (arr, item) {
    for (let i = arr.length - 1; i >= 0; i--) {
        if (arr[i] == item) {
            arr.splice(i, 1);
        }
    }
    return arr;
}